<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition>
	
		<h:panelGroup rendered="#{not empty timeBean.times}">
			<h2>Lista de Times</h2>
			<h:dataTable id="tabela" value="#{timeBean.times}" var="time"
			    styleClass="dados" rowClasses="par, impar">
			    <h:column>
			    	<f:facet name="header">ID</f:facet>
			    	#{time.id}
			    </h:column>
			    <h:column>
			    	<f:facet name="header">Nome</f:facet>
			    	#{time.nome}
			    </h:column>
			    <h:column>
			    	<f:facet name="header">Técnico</f:facet>
			    	#{time.tecnico}
			    </h:column>
			    <h:column>
			    	<f:facet name="header">Alterar</f:facet>
			    	<f:ajax event="click" render="@form" listener="#{timeBean.preparaAlteracao}">
			    		<h:commandLink>
			    			<f:param name="id" value="#{time.id}" />
			    			Alterar
			    		</h:commandLink>
			    	</f:ajax>
			    </h:column>
			    <h:column>
			    	<f:facet name="header">Remover</f:facet>
			    	<f:ajax event="click" render="@form" listener="#{timeBean.remove}">
			    		<h:commandLink>
			    			<f:param name="id" value="#{time.id}"/>
			    			Remover
			    		</h:commandLink>
			    	</f:ajax>
			    </h:column>
			</h:dataTable>
		</h:panelGroup>
	
</ui:composition>
</html>